from pms.common.views import PostFormula
from user.utils.role import create_role
from user.utils.profile import role_view


class API(PostFormula):

    require_permissions = [12]

    def handle(self, req):
        name = req['name']
        role = create_role(name)
        return self.success_respond(role_view(role))
